package com.safebox.utils;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.text.TextUtils;

import com.safebox.security.DataSecurity;

public class DialogUtils {

    public static ProgressDialog mProgressDialog;
    public static void showFailedDialog(Context context, String title, String message) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
       

        if (TextUtils.isEmpty(title) || TextUtils.isEmpty(message)) {
            return;
        }

        final AlertDialog dialog = builder.setTitle(title).setMessage(message).create();
        dialog.show();
    }
    
    public static Dialog createCustomAlertDialog(Context context, String title, String content)
    {
        AlertDialog dialog = new AlertDialog.Builder(context)
        .setTitle(title)
        .setMessage(DataSecurity.desDecrypt(content))       
        .create();
        return dialog;
    }
    public static void showProgressBarDialog(Context context, String message) {
        mProgressDialog = new ProgressDialog(context);
        mProgressDialog.setMessage(message);
        mProgressDialog.show();
    }

    public static void dismissProgressBar() {
        if (mProgressDialog != null) {
            mProgressDialog.dismiss();
        }
    }
}
